/**
 * Created by 国彬 on 2016/4/24.
 */

$(function() {
    $('.navbar-header').click(function(){
        window.open("home.html",'_self');
    });


    function getContextPath() {
        return window.location.host;
    }


    // 在键盘按下并释放及提交后验证提交表单
    $("#login-form").validate({
        rules: {
            log_password: {
                required: true,
                minlength: 5
            },
            log_email: {
                required: true,
                email: true
            },

        },
        messages: {

            log_password: {
                required: "Please enter your password",
                minlength: "five letters required at least"
            },

            log_email: "Please enter correct mail",
        },
        success: function (label) {
            label.removeClass("unchecked").addClass("checked");
        },
        submitHandler: function (form) {
            form.submit();
        }
    });


    // 在键盘按下并释放及提交后验证提交表单
    $("#register-form").validate({
        rules: {
            reg_username: {
                required: true,
                minlength: 2
            },
            reg_password: {
                required: true,
                minlength: 5
            },
            reg_confirm_pwd: {
                required: true,
                minlength: 5,
                equalTo: "#reg_password"
            },
            reg_email: {
                required: true,
                email: true
            },
            reg_phone: {
                required: true,
                minlength: 11
            }
        },
        messages: {
            reg_username: {
                required: "Please enter your name",
                minlength: "two letters required at least"
            },
            reg_password: {
                required: "Please enter your password",
                minlength: "five letters required at least"
            },
            reg_confirm_pwd: {
                required: "Please enter your password",
                minlength: "five letters required at least",
                equalTo: "The passwords you typed do not match. Type the same password in both text boxes."
            },
            reg_email: "Please enter correct mail",
        },
        success: function (label) {
            label.removeClass("unchecked").addClass("checked");
        },
        submitHandler: function (form) {
            alert("submit!");
            form.submit();

        }
    });


});
function registerPage(){
    window.open("/AnyPickup/PageService/register.html","_self")
}

function loginPage(){
    window.open("/AnyPickup/PageService/login.html","_self")
}
